home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / TSPA3340.ZIP / TSUNTA.INT < prev    next >
Text File  |  1992-06-13  |  5KB  |  115 lines

  1. (*
  2. Timo Salmi UNiT A
  3. A Turbo Pascal unit for sideways scrolling (panning)
  4. All rights reserved 22-Jul-89
  5. Updated 28-Jul-89, 19-Aug-89, 17-Mar-90, 15-Jul-90
  6.  
  7. The compiler tp 4.0 / 5.0 / 5.5 compatible directives which were used at
  8. complile-time as show below:
  9. *)
  10.  
  11. {$B-}     (* Short circuit boolean evaluation *)
  12. {$D-}     (* No bebug information *)
  13. {$F-}     (* Force far calls off *)
  14. {$I+}     (* Input/output checking on *)
  15. {$N-}     (* No numeric coprocessor *)
  16. {$R-}     (* No range-checking *)
  17. {$S+}     (* Stack overflow checking *)
  18. {$V+}     (* Strict var-string checking *)
  19.  
  20. (*
  21. There are many excellent (mostly commercial) Turbo Pascal units available,
  22. such as Turbo Power's Turbo Professional with hosts of useful procedures
  23. and functions. However, I have not come upon procedures which would scroll
  24. a screen, or part of the screen, SIDEWAYS. So here is a Turbo Pascal unit
  25. for vertical scrolling. It uses direct moves of memory, and is very fast.
  26. Because of this method, the older CGAs may experience snow.
  27.  
  28. This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
  29. NON-INSTITUTIONAL purposes, provided it is not changed in any way. For
  30. ANY other usage, such as use in a business enterprise or a university,
  31. contact the author for the terms of registration.
  32.  
  33. The units are under development. Comments and contacts are solicited. If
  34. you have any questions, please do not hesitate to use electronic mail for
  35. communication.
  36. InterNet address: ts@chyde.uwasa.fi         (preferred)
  37. Funet address:    GADO::SALMI
  38. Bitnet address:   SALMI@FINFUN
  39.  
  40. The author shall not be liable to the user for any direct, indirect or
  41. consequential loss arising from the use of, or inability to use, any unit,
  42. program or file howsoever caused. No warranty is given that the units and
  43. programs will work under all circumstances.
  44.  
  45. Timo Salmi
  46. Professor of Accounting and Business Finance
  47. Faculty of Accounting & Industrial Management; University of Vaasa
  48. P.O. BOX 297, SF-65101 Vaasa, Finland
  49.  
  50. *)
  51.  
  52. unit TSUNTA;
  53.  
  54. (* ======================================================================= *)
  55.                           interface
  56. (* ======================================================================= *)
  57.  
  58. uses Dos,
  59.      Crt,
  60.      TSUNTE;
  61.  
  62. (* Procedure for vertical scrolling moving right.
  63.    The area to be panned is defined by x1, y1, x2, y2.
  64.    The move sideways can be taken in strides by defining a step > 1.
  65.    If the parameters are invalid (say x1 = 100), the program is
  66.    aborted with and error message. Step = 0 is invalid.
  67.    Use in text mode only.
  68.    The width 40/80 of the text mode is detected by the unit unless
  69.    you toggle the texmode.
  70.    The (maximum) hight is 25 rows.
  71. *)
  72. procedure PANMR (x1, y1, x2, y2, step : byte);
  73.  
  74. (* Procedure for vertical scroll moving left *)
  75. procedure PANML (x1, y1, x2, y2, step : byte);
  76.  
  77. (* The width of the text screen
  78.    You do not necessarily need this in using panmr and panml because they
  79.    take care of the width themselves. Consider it a perk :-) *)
  80. function WIDTHFN : byte;
  81.  
  82. (* This is supposed to be the height of the text screen. Actually, it seems
  83.    to give the resolution 25, 43, or 50.  Whether that is the true height
  84.    of the screen depends on your application. This function is has no
  85.    connection with panning. It is here because it best belongs to this unit
  86.    along with widthfn *)
  87. function HIGHTFN : byte;
  88.  
  89. (*
  90. Each of the 80x25 (or 40x25) locations of a text-screen have in video
  91. memory an information byte on the character and its attribute, that is
  92. color starting from 0 black, 1 blue, and so on. Here are the means of
  93. access. One particularly useful trick is to write to location 80,25
  94. directly, since then the screen will not scroll as it would were you
  95. to use GoToXY (80,25); write ('X'); Furthermore, direct screen writes
  96. enable writing the ascii 0-31 characters without their special meaning.
  97. This fact can be utilized to widen the displayable character set.
  98. *)
  99.  
  100. (* A function to calculate a color attribute for VIDXY *)
  101. function ATTRIBFN (fgColor, bgColor : byte) : byte;
  102.  
  103. (* Write a single character ch at (column,row) using attribute,
  104.    directly to the video memory. If you do not know how the attribute
  105.    is defined for video memory, use the attribfn function *)
  106. procedure VIDXY (column, row : byte; ch : char; attrib : byte);
  107.  
  108. (* Read a single character from video memory *)
  109. function VDCHXYFN (column, row : byte) : char;
  110.  
  111. (* Read a single attribute from video memory *)
  112. function VDATXYFN (column, row : byte) : byte;
  113.  
  114.  
  115.